package com.stat;

import java.util.Hashtable;

import com.info.BonusInfo;
import com.info.BonusTypeEnum;
import com.info.ClassInfo;
import com.info.SkillInfo;

public class CharacterClass {
	private Hashtable<ClassInfo, Integer> classes;
	
	public CharacterClass(ClassInfo info){
		classes = new Hashtable<ClassInfo, Integer>();
		classes.put(info, 1);
	}
	
	public void addClass(ClassInfo info){
		if (classes.containsKey(info)){
			classes.put(info, classes.get(info) + 1);
		}else{
			classes.put(info, 1);
		}
	}
	
	public BonusInfo getTotalBonus(BonusTypeEnum type, String condition){
		BonusInfo bonus = new BonusInfo();
		for (ClassInfo info : classes.keySet()){
			bonus.addBonus(info.getBonus(type, condition), classes.get(info).intValue());
		}
		return bonus;
	}
	
	public boolean containClassSkill(SkillInfo skill){
		for (ClassInfo info : classes.keySet()){
			if (info.isClassSkill(skill)){
				return true;
			}
		}
		return false;
	}
}
